In general, a processor executes a program. A program includes instructions, which are stored as a sequence of bytes in a memory. An instruction, also called a machine instruction or macroinstruction, can (in the general case) consist of one or several bytes, and contains an opcode field defining its basic function, e.g. an arithmetic operation or a conditional jump in the execution sequence (instead of continuing to the next instruction). The instruction may contain other fields that may specify one or more operands. The program (sequence of instructions in the memory) has usually been produced, beforehand, by a compiler or assembler—a tool that itself is a program, which takes the programmer's source code text as input.
A processor may be built as an integrated circuit, which is then called a microprocessor.
Normally other devices can be connected to the processor and exchange data with it. These are called peripherals. Some can contain electromechanics (e.g. a printer or hard disk), but some can be purely electronic. They all have digital control electronics for interfacing with the processor, and usually also for their internal control.
It is very common to add memory and peripheral electronics on the same IC chip as the processor, in order to reduce the parts count in an embedded system (a digitally controlled device that is not a PC or server computer). The IC is then called a microcontroller, and the processor part of it is called the processor core.
In general, a processor core is a digital device that can perform different sets of actions for each cycle of a high-frequency clock signal. The processor core typically includes two main parts, or units. One is the execution unit, where data can be taken in (from memory or peripherals), operated on, temporarily stored in registers, and/or output (to memory or peripherals). The other part is the control unit, which, for every cycle of the clock, controls the actions of the execution unit and itself, based on the state reached in the previous cycle.
The control signals created by the control unit can be generated by digital gates that sense the contents of the instruction register, the sequence counter (assuming the processor has multi-cycle instructions), and other registers and flip-flops that define the machine state in the current clock cycle.
An alternative used in more complex processors is to generate the control signals from microcode words (also referred to as microinstructions). These can be thought of as words consisting of bits or bit fields, each representing control signals as defined by their positions in the word, and each word specifying the respective signal levels to be produced during the current clock cycle. The technique is similar to that used in jacquard looms, player pianos, and pegged drum controllers for old washing machines or music boxes (also used in clock chiming mechanisms from the 14th century). Each microinstruction corresponds to a line of holes in the paper roll for a player piano, and all the lines of holes on the paper roll together correspond to a micro program stored in a control store, or micro program memory. This special (wide and fast) memory, internal to the control unit of the processor core, outputs a microinstruction for every clock cycle. A difference from the player piano is that the microinstruction sequence can contain jumps, i.e. control does not always pass from one microinstruction to the next one in the stored sequence. The processor core has the control logic needed to execute the microinstructions, e.g. to generate the direct control signals to select sources of data, select operation of the arithmetic unit, select destinations for data, increment/decrement counters, and select or calculate the next microprogram address.
This means that there is an additional level of control, between the program and the executing hardware. This level usually treats the instructions of the program as data, which it, under microprogram control, brings into the execution unit and operates on. The execution unit then also comprises a resource for calculating the next microprogram address. In the beginning of the execution of a program instruction, the microcode normally analyzes the operation code of the instruction and creates a microprogram address to the start of the execution microcode sequence for that opcode. It then computes the next microprogram address using a counter for stepping ahead in the sequence and typically a multiplexor to select other alternatives, i.e. doing jumps in the microprogram.
Since the execution of a microinstruction produces (among other results) the address of the next microinstruction, a hardware loop is created, in which there must be at least one register (otherwise there would be a “combinatorial loop”, which results in uncontrolled behavior). Preferably that requirement is fulfilled by a microinstruction register, which stores the microinstruction, i.e. the output from the control store.
The microprogram is normally contained in a special microprogram memory, referred to as the control store, in the control unit of the processor core (and not in the main memory where the application program is stored). The microprogram controls the details of the processor core as it controls the execution hardware to first fetch a machine instruction from the application program in the main memory and then execute this instruction by performing arithmetic/logic or other operations and determining the next program address, as specified by the microprogram.
Although microprogrammed processors represent a significant advance in processor technology, especially by allowing higher complexity of operation and thereby increased overall flexibility and efficiency, there is still a general demand, especially in embedded systems, for processors that are even more efficient, e.g. with lower cost and lower power consumption, through higher program density, more efficient use of hardware resources, and/or higher flexibility for different kinds of special operations.